package com.example.tiptravel.presenter.home;

import com.example.tiptravel.entity.home.Labels;
import com.example.tiptravel.model.ModelFactory;
import com.example.tiptravel.view.impl.home.LabelView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by 45820 on 2016/11/9.
 */

public class LabelPresenter {
    private LabelView labelView;

    public LabelPresenter(LabelView labelView) {
        this.labelView = labelView;
    }

    public void getLabelData(Map<String,String> map){
        ModelFactory.getiHomeModel().getLabelData(map, new Subscriber<Labels>() {
            @Override
            public void onCompleted() {
                labelView.onComplete();
            }

            @Override
            public void onError(Throwable e) {
                labelView.onFailure(e);
            }

            @Override
            public void onNext(Labels labels) {
                labelView.onSuccess(labels);
            }
        });
    }
}
